package cc.user;

import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import org.apache.log4j.Logger;

import compare.SqlJYTUtils;

public class Sys_Account_test {

	private static Logger log = Logger.getLogger(" ");
	static {
		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			log.error("驱动加载异常：" + e.getMessage());
		}
	}
	public static void main(String[] args) throws SQLException, IOException {
		long time = System.currentTimeMillis();
		Connection connMysql = DriverManager.getConnection(SqlJYTUtils.getMySqlJytUrl());
		
		String insertUser = "INSERT INTO `business`.`sys_user_account`"
				+ " (`USER_ID`, `ACCOUNT`, `PASSWORD`,`REGISTER_TIME`,`AAE014`,`IS_LOCKED`)"
				+ " VALUES (?, ?, ?,'2017-10-03 00:00:00','财务转换','0')";
		PreparedStatement stmt1 = connMysql.prepareStatement(insertUser);
		
		String userid = "44E3DFB66CD64DF19A1B84400FD3FEFF";
		stmt1.setString(1, userid);
		stmt1.setObject(2, "djdljwcj");
		stmt1.setString(3, "21037E2D2DB262951C31997082572F5B2");
		String insertExt = "INSERT INTO `business`.`sys_user_account_ext`"
				+ " (`USER_ID`, `C_TIME`, `TYPE`, `BUSINESSID`, `BUSINESSNAME`, `ID`)"
				+ " VALUES (?, ?, 'E0', ?, '就业职介系统财务导入', ?)";
		PreparedStatement stmt3 = connMysql.prepareStatement(insertExt);
		stmt3.setString(1, userid);
		stmt3.setObject(2, "2017-10-03 00:00:00");
		stmt3.setString(3, "8a948079633d629001633d6cd5aa0001");
		stmt3.setString(4, userid);
		String accountroleSql="INSERT INTO `business`.`sys_account_role` (`USER_ID`, `ROLE_ID`) VALUES"
				+ " (?, '2FDBA17865607E06E050007F01001D44'), (?, '2FDBA17865607E06E050007F01001D66'), (?, '2FDBA17865617E06E050007F01001D55'),(?, '2FDBA17865617E06E050007F01001D77')";
		PreparedStatement stmt4 = connMysql.prepareStatement(accountroleSql);
		stmt4.setString(1, userid);
		stmt4.setString(2, userid);
		stmt4.setString(3, userid);
		stmt4.setString(4, userid);
		stmt1.execute();
		stmt3.execute();
		stmt4.execute();
		connMysql.close();
		log.info("按账户，全部对比完成，耗时:" + (System.currentTimeMillis() - time) + "ms");
	}

	
}